def read2list(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data
def a(q):
    u=list(map(int,q))
    return u
def sortm (A):
    N=len(A)
    for i in range(N-1):
        for j in range(N-2,i-1,-1):
            if A[j+1]<A[j]:
                A[j],A[j+1]=A[j+1],A[j]
    return A
from time import*
m1 = read2list("m1_sorted.txt")
m2 = read2list("m2_reverse.txt")
m3 = read2list("m3_shuffle.txt")
l=a(m1)
j=a(m2)
p=a(m3)
ts=time()
e=sortm(l)
tf=time()
print("m1_sorted.txt","Время",round((tf-ts)*1000),'milliseconds')
ts=time()
t=sortm(j)
tf=time()
print("m2_reverse.txt","Время",round((tf-ts)*1000),'milliseconds')
o=sortm(p)
ts=time()
t=sortm(j)
tf=time()
print ("m3_shuffle.txt","Время",round((tf-ts)*1000),'milliseconds')

